package netty.inboundhandlerandoutboundhandler;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * Created by yu756 on 2020/1/9 10:18
 */
public class MyServerInitializer extends ChannelInitializer<SocketChannel> {


    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();

        // 加入入站handler进行解码  MyByteToLongDecoder
        pipeline.addLast(new MyByteToLongDecoder());
        // 自定义handler 处理业务逻辑
        pipeline.addLast(new MyLongToByteEncoder());
        pipeline.addLast(new MyServerHandler());

    }
}
